<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="computerRoomList" checkbox="true" fitColumns="true" title="机房" actionUrl="computerRoomController.do?datagrid" idField="id" fit="true" queryMode="group">
   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建人名称"  field="createName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建人登录名称"  field="createBy"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建日期"  field="createDate" formatter="yyyy-MM-dd" hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新人名称"  field="updateName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新人登录名称"  field="updateBy"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新日期"  field="updateDate" formatter="yyyy-MM-dd" hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="机房归属楼栋"  field="buildingNo" query="true" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="机房编号"  field="roomNo" query="true" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="座位行数"  field="rowsCount" queryMode="single"  width="80"></t:dgCol>
   <t:dgCol title="座位列数"  field="rowsCols" queryMode="single"  width="80"></t:dgCol>
   <t:dgCol title="负责人"  field="charger"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="消费价格"  field="costPerHour"    queryMode="single"  width="120"></t:dgCol>
<%--    <t:dgCol title="机房用途"  field="useInfo"    queryMode="single"  width="120"></t:dgCol> --%>
<%--    <t:dgCol title="备注"  field="remark"    queryMode="single"  width="120"></t:dgCol> --%>
   <t:dgCol title="开放时间"  field="openTimeBegin"  queryMode="single"  width="100" formatter="yyyy-MM-dd hh:mm"></t:dgCol>
   <t:dgCol title="结束时间"  field="openTimeEnd"  queryMode="single"  width="100" formatter="yyyy-MM-dd hh:mm"></t:dgCol>
<%--    <t:dgCol title="开放地点"  field="openLocation" hidden="true" queryMode="single"  width="120"></t:dgCol> --%>
   <t:dgCol title="操作" field="opt" width="150"></t:dgCol>
<%--    <t:dgFunOpt title="开放时间" funname="setOpenTime(id)"></t:dgFunOpt>  --%>
   <t:dgDelOpt title="删除" url="computerRoomController.do?doDel&id={id}" />
   <t:dgToolBar title="录入机房信息" icon="icon-add" url="computerRoomController.do?goAdd" funname="add" width="556"></t:dgToolBar>
   <t:dgToolBar title="编辑" icon="icon-edit" url="computerRoomController.do?goUpdate" funname="update" width="556"></t:dgToolBar>
   <t:dgToolBar title="批量删除"  icon="icon-remove" url="computerRoomController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>
   <t:dgToolBar title="查看" icon="icon-search" url="computerRoomController.do?goUpdate" funname="detail" width="556"></t:dgToolBar>
   <t:dgToolBar title="设置开放时间" icon="icon-edit" funname="setOpenTime()" width="432"></t:dgToolBar>
   <t:dgToolBar title="设置消费价格" icon="icon-edit" funname="setCost()"></t:dgToolBar>
<%--    <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar> --%>
<%--    <t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar> --%>
<%--    <t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar> --%>
  </t:datagrid>
  </div>
 </div>
 <script src = "webpage/com/mengtian_tech/device_mgr/room/computerRoomList.js"></script>		
 <script type="text/javascript">
 $(document).ready(function(){
 		//给时间控件加上样式
 			$("#computerRoomListtb").find("input[name='createDate']").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 			$("#computerRoomListtb").find("input[name='updateDate']").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 });
 
//导入
function ImportXls() {
	openuploadwin('Excel导入', 'computerRoomController.do?upload', "computerRoomList");
}

//导出
function ExportXls() {
	JeecgExcelExport("computerRoomController.do?exportXls","computerRoomList");
}

//模板下载
function ExportXlsByT() {
	JeecgExcelExport("computerRoomController.do?exportXlsByT","computerRoomList");
}

function setOpenTime(){
	 var rowsData = $('#computerRoomList').datagrid('getSelections');
	 if(rowsData.length==0){
		 tip("至少选择一个机房");
		 return;
	 }
	 var ids = "";
	 for(var i=0; i<rowsData.length;i++){
		 if(rowsData[i].id!=null){
			 ids += (rowsData[i].id + ",");
		 }
	 }
	  var addurl = 'computerRoomController.do?setOpenTime&ids='+ids;
	  $.dialog({
		  	id:'1',
			content: 'url:'+addurl,
			lock : true,
			zIndex: 1000, 
			width:432,
			height:150,
			title:'设备开放时间设置', 
			opacity : 0.3,
			cache:false,
		    ok: function(){
		    	iframe = this.iframe.contentWindow;
		    	$('#btn_sub', iframe.document).click(); 
		    	$('#computerRoomList').datagrid('reload',{});
				return false;
		    },
		    cancelVal: '关闭',
		    cancel: true /*为true等价于function(){}*/
		});

}

function setCost(){
	 var rowsData = $('#computerRoomList').datagrid('getSelections');
	 if(rowsData.length==0){
		 tip("至少选择一个机房");
		 return;
	 }
	 
	 var ids = "";
	 for(var i=0; i<rowsData.length;i++){
		 if(rowsData[i].id!=null){
			 ids += (rowsData[i].id + ",");
		 }
	 }
	 
	  var addurl = 'computerRoomController.do?setCostPage&id='+ids;
	  $.dialog({
		  	id:'2',
			content: 'url:'+addurl,
			lock : true,
			zIndex: 1000, 
			width:410,
			height:150,
			title:'消费设置', 
			opacity : 0.3,
			cache:false,
		    ok: function(){
		    	iframe = this.iframe.contentWindow;
		    	$('#btn_sub', iframe.document).click(); 
				return false;
		    },
		    cancelVal: '关闭',
		    cancel: true /*为true等价于function(){}*/
		});

}
 </script>